#ifndef __TEMPTORES_PERIPHERAL_H
#define __TEMPTORES_PERIPHERAL_H


#define CLK_PIN             28//6//7
#define DATA_PIN            27//12//5//7//5
#define ADDR0_PIN           30//
#define ADDR1_PIN           29//
//#define RESET_PIN           13//6

#define WRITE               0x00
#define READ                0x01

#define AD_CLK_SET         nrf_gpio_pin_set(CLK_PIN)
#define AD_CLK_CLEAR       nrf_gpio_pin_clear(CLK_PIN)

#define AD_DATA_OUT        nrf_gpio_cfg_output(DATA_PIN)
#define AD_DATA_SET        nrf_gpio_pin_set(DATA_PIN)
#define AD_DATA_CLEAR      nrf_gpio_pin_clear(DATA_PIN)
#define AD_DATA_IN         nrf_gpio_cfg_input(DATA_PIN,NRF_GPIO_PIN_NOPULL)


void delay_ms(uint16_t usNms);
void delay_us(uint16_t usNus); 
void IIC_Init(void);
void IIC_user_write(uint8_t i2c_addr, uint8_t WR_CMD ,uint16_t write_data);
uint16_t  IIC_single_byte_read(uint8_t i2c_addr, uint8_t Daddr, uint8_t Waddr);
void my_flash_store(uint8_t * data_value, uint32_t len, uint16_t offset);
void my_flash_read(uint8_t * data_value, uint16_t len, uint16_t offset);
void app_flash_init(void);
void my_flash_init(void);

uint8_t TempToRes_ReadCalParam(TempCal_Param_ST  *pstCalParam, uint8_t ChipID);
uint8_t TempToRes_StoreCalParam(TempCal_Param_ST  *pstCalParam, uint8_t ucRange, uint8_t ChipID);

uint8_t DataConvert_Itoa(char* dst, const uint8_t* src, int len);
#endif


